Skip to content

Use the language plural rule when importing locales with a different text parent - #1528

Open
AryanRG wants to merge 1 commit into
python-babel:masterfrom
AryanRG:fix/cldr-plurals-for-explicit-parent-locales
Open

AryanRG wants to merge 1 commit into
python-babel:masterfrom
AryanRG:fix/cldr-plurals-for-explicit-parent-locales

Conversation

@AryanRG

@AryanRG AryanRG commented Dec 1, 2026

Copy link
Copy Markdown

Angolan Portuguese inherits its unit patterns from European Portuguese, but CLDR assigns it the general Portuguese plural rule. Babel currently applies the European Portuguese rule as well, so Locale('pt', 'AO').plural_form(0) returns other and format_unit(0, 'duration-day', locale='pt_AO') produces 0 dias. ICU returns one and 0 dia.

When importing a locale with an explicit parent for its text, record the language’s plural rule if the locale has no rule of its own. CLDR 49 defines a separate parent table for plurals with no overrides. CLDR 49 parent locales · UTS #35 inheritance rules

The regression covers both Angola and Portugal. Comparing the imported cardinal and ordinal rules with CLDR 49 across all 1,147 locales found ten cardinal mismatches before the change and none afterward. The full test suite passed with 8,293 tests, three skips and two expected failures.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant